<%= form_for(@role) do |f| %>
  <% if @role.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@role.errors.count, "error") %> prohibited this role from being saved:</h2>

      <ul>
      <% @role.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="actions">
    <p>
      <%= f.label :name %>
      <%= f.text_field :name %>
    </p>
    <p>
      <%= fields_for :permissions do |form| %>
        <% Permission.all.each do |permisson| %>
           <label>
             <%= form.check_box permisson.id %>
             <%= permisson.action.humanize %>
           </label>
        <% end %>
      <% end %>
    </p>

    <%= f.submit %>
  </div>
<% end %>
